﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CefSharp;
using CefSharp.WinForms;

namespace xCloud
{
    public partial class Form1 : Form
    {
        chromeWrap _wrap = new chromeWrap();
        public Form1()
        {
            InitializeComponent();
            CefSettings settings = new CefSettings();
            Cef.Initialize(settings);
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            Size ScreenSize = new Size(System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width, System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height);
            this.Height = ScreenSize.Height;
            this.Width = 480;

            this.Location = new Point(ScreenSize.Width - this.Width, 0);
        }

        private void menu_login_Click(object sender, EventArgs e)
        {
            main_page.Hide();
            _wrap.LoadWebPage(browser_view, "https://guxiaofengxltd.xyz/call.html?ajkx=login&cookie=true");
        }

        private void menu_account_Click(object sender, EventArgs e)
        {
            main_page.Hide();
            _wrap.LoadWebPage(browser_view, "https://guxiaofengxltd.xyz/call.html?ajkx=login");
        }

        private void menu_register_Click(object sender, EventArgs e)
        {
            main_page.Hide();
            _wrap.LoadWebPage(browser_view, "https://guxiaofengxltd.xyz/call.html?ajkx=register");
        }

        private void menu_manual_Click(object sender, EventArgs e)
        {
            main_page.Hide();
            _wrap.LoadWebPage(browser_view, "https://gitee.com/XBF_1/apps/blob/master/README.md");
        }

        private void menu_dev_Click(object sender, EventArgs e)
        {
            main_page.Hide();
            _wrap.LoadWebPage(browser_view, "https://gitee.com/XBF_1/apps/blob/master/development.md");
        }

        private void notifyIcon1_MouseClick(object sender, MouseEventArgs e)
        {
            this.Visible = true;
            this.WindowState = FormWindowState.Normal;
            this.notifyIcon1.Visible = false;
        }

        private void Form1_SizeChanged(object sender, EventArgs e)
        {
            if (this.WindowState == FormWindowState.Minimized)
            {
                this.Hide();
                this.notifyIcon1.Visible = true;
            }
        }
    }
}
